<?php

namespace App\Http\Model;

use Illuminate\Database\Eloquent\Model;

class ConsoleAccount extends Model
{
    protected $table = 'console_account';		//related table name
    protected $guarded = [];

    //访问器：获取用户的密码自动转换解密密码
    public function getPasswordAttribute($value)
    {
        try {
            return $value;
        } catch (DecryptException $e) {
            throw $e;
        }
    }


    //修改器：给用户的密码加密
    public function setPasswordAttribute($value)
    {
        $this->attributes['password']=bcrypt($value);
    }
}
